#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<string.h>

int main()
{
//     const char* msg = "hello world!\n";
//     printf("my name is wml!\n");
//     fputs("this is my first time to use vscode!\n",stdout);
//     write(1,msg,strlen(msg));
//     fork();

    pid_t id = fork();
    if(id<0)
    {
        printf("fork error!\n");
        return 1;
    }
    else if(id==0)
    {
        while(1)
        {
            printf("this is a child process!,pid is :%d,my parent pid is :%d\n",getpid(),getppid());
            sleep(1);
        }

    }
    else{
        while(1)
        {
            printf("我是一个父进程!我的pid是:%d,ppid---->%d\n",getpid(),getppid());  
            sleep(1);

        }

    }
    return 0;


//    pid_t id = fork();
//    if( id == 0 )
//    {
//        printf("this is a child process\n");
//        return 0;
//    }
//    else if( id < 0 )
//        printf("fork error!\n");

//    printf("a parent process!\n");
//    return 0;

}
